pp108 : select Method

select Method

 


This method starts an application and loads the container of an application. If the application is already started, it brings the container of that application to focus.

Syntax


application.select(oApplicationDef [, vData] [, fpCallback])

Parameters

Parameter

Description

oApplicationDef

Required. Object that contains the application definition used to open the application.
Note: You should always pass a Node of type Element(NodeType 1), not Document(NodeType 9).

vData

Optional. Variant that contains the data that is passed as a parameter to the application that will be opened.

fpCallBack

Optional. Pointer to a function that is to be called after the application is loaded completely.

 

Return Value


No return value.

Remarks


To create or open applications in Process Platform Ajax Toolkit framework, the select() method is used. This method internally calls the system component's select() method to create or open an application. This helps in sharing data across different applications in the Process Platform framework.

The activities of the select method can be explained in the following steps:

  1. Creates a container for the application definition specified.
  2. Loads the url inside it and have the target application fire an onselect event with specified data.
  3. Calls the call back method once the onselect event has happened.

    To create an application, an Application Definition is given as an input to the select method. A sample XML definition would look like the one below:

XML

<script id="newApplication" type="cordys/xml">
    <Application>
        <id>multiFunctionalGrid</id>
        <description>Multi Functional Grid</description>
        <caption>Multi Functional Grid</caption>
        <url>/cordys/wcp/demo/multiFunctionalGrid.htm</url>
        <frame>main</frame>
    </Application>
</script>



The above application definition opens a page specified in the url in the main frame of the application. The following script opens the application with data that is passed to the opening page:

Scripting

var data = "test data"; //Create the application application.select(newApplication.XMLDocument.documentElement, data, callBack);



In the opening application (multiFunctionalGrid.htm, in this case), the data can be captured by specifying in the onselect method:

HTML

<HTML onselect="selectApplication()"> //Script for onselect call function selectApplication() { application.notify(application.event.data); }



As in the above application definition, the callBack function can be written in the source application as follows:

Scripting

function callBack() { application.notify("Application loaded successfully !"); }



Note:
The select method can be used to open new windows, which do not belong to one of the frames in Cordys. To open a new window, the frame property of the application definition must be set to "_new" and the frame property can be specified with a features attribute which is the same as the "features" parameter of the window.open()method. To open an application in a modal window, use the showDialog() method of the application component.

For an onselect event to be fired for standalone applications and for applications loaded in iframe or in wizard steps, the URL should contain the data as query string with value as XML string. Example: /cordys/wcp/testonselect.htm?data="<data/>".

See Also


application, system, Application Definition, container